<%-- 
    Document   : ManagePk
    Created on : Sep 27, 2010, 7:50:21 PM
    Author     : IYB
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" import="java.sql.*, manageroute.*, java.util.ArrayList"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home</title>
<link rel="shortcut icon" type="image/x-icon" href="includes/images/favicon.png" />
<link rel="stylesheet" type="text/css" media="screen" href="includes/css/resetter.css" title="resetter" />
<link rel="stylesheet" type="text/css" media="screen" href="includes/css/style.css" />
<script type="text/javascript" src="includes/js/auto-width.js"></script>
</head>
<body>
	<div id="wrap">
		<div id="header">
			<div id="top-logo"><img src="includes/images/transmit.png" style="height:70px"/></div>
			<div id="top-name">SMARTravel</div>
			<div id="login-form">
				<input type="text" value="username"/> <input type="password" value="password"/> <button>Login</button><br/>
				<a href="lostpassword.html">lost password?</a>, or <a href="register.html">register</a>
			</div>
			<div style="clear:both;margin-bottom:-20px"></div>
		</div>
		<div id="top-menu">
			<ul>
				<li><a href="index.jsp">Home</a></li>
				<li><a href="ManageServices.jsp">Service</a></li>
				<li><a href="User.jsp">User</a></li>
				<li><a href="MyOrder.jsp">My Order</a></li>
				<li><a href="OrderList.jsp">Order List</a></li>
				<li><a href="PaymentConfirm.jsp">Payment Confirm</a></li><li><a href="PaymentNotice.jsp">Payment Notice</a></li>
				<li><a href="Resources.jsp">Resources</a></li>
				<li><a href="CustomizeInfo.jsp">Customize Info</a></li>
				<li><a href="UserManagement.jsp">User Management</a></li><li><a href="Statistics.jsp">Statistics</a></li>
				<li><a href="Contact.jsp">Contact</a></li>
			</ul>
		</div>
    	<div id="main">
			<div style="float:left; width:50%"><img src="includes/images/public-transport.jpg" style="width:400px"/></div>
			<div style="float:left; width:50%">
				<h1>Manage Package Service</h1>
				<p>Pada halaman ini anda dapat mengatur mengenai layanan pengiriman paket.</p>
				<br>
  <table width="386" border="1">
    <tr>
      <th width="150" scope="col">Kota Asal</th>
      <th width="150" scope="col">Kota Tujuan</th>
      <th width="150" scope="col">Tarif(per Kg)</th>
      <th width="150" scope="col">Simpan Perubahan</th>
      <th width="150" scope="col">Hapus</th>
    </tr>
    <%
                ArrayList<DBPkt> dbpktList = (ArrayList<DBPkt>)request.getAttribute("dpktList");
                if (dbpktList != null)
                {

                for (int i=0; i < dbpktList.size(); i++) {
                    String idTrayek = dbpktList.get(i).getIdTrayek();
                    String kotaAsal = dbpktList.get(i).getKotaAsal();
                    String kotaTujuan = dbpktList.get(i).getKotaTujuan();
                    int tarif = dbpktList.get(i).getTarif();
        %>
                            <tr valign="top">
                            <form action="ManagePkServlet" method="post">
                                <input type="hidden" name="command" value="edit"/>
                                <input type="hidden" name="idTrayek" value="<% out.print(idTrayek); %>" />
                                <td><div align="center"><input type="text" name="kotaasal" value=<% out.print(kotaAsal); %>></div></td>
                                <td><div align="center"><input type="text" name="kotatujuan" value=<% out.print(kotaTujuan); %>></div></td>
                                <td><div align="center"><input type="text" name="tarif" value=<% out.print(tarif); %>></div></td>
                                <td><div align="center"><input type="submit" value="Simpan" /></div></td>
                            </form>
                                <td>
                                <div>
                                <form action="ManagePkServlet" method="post">
                                        <input type="hidden" name="command" value="delete"/>
                                        <input type="hidden" name="idTrayek" value="<% out.print(idTrayek); %>" />
                                        <input type="submit" value="Hapus" />
                                </form>
                                </div>
                                </td>
                            </tr>
            <%
                }
                }
        %>
    </table>
    <p>Isi di sini untuk menambah data yang ada :</p>
    <form action="ManagePkServlet" method="post">
    <input type="hidden" name="command" value="add"/>
    <table width="327">
      <tr>
        <td width="96">Kota Asal</td>
        <td width="152">
          <input type="text" name="kotaasal">
        </td>
        <td width="63">&nbsp;</td>
      </tr>
      <tr>
        <td width="96">Kota Tujuan</td>
        <td width="152">
          <input type="text" name="kotatujuan">
        </td>
        <td width="63">&nbsp;</td>
      </tr>
      <tr>
        <td>Tarif</td>
        <td>
          <input type="text" name="tarif"></td>
        <td><input type="submit" name="button7" id="button7" value="Tambah" /></td>
      </tr>
    </table>
    </form>
    <br>
    <p style="color: red">
    <%
            String error = (String)request.getAttribute("error");
            if(error != null) out.println(error);
    %>
    </p>
  <p>&nbsp;</p>
			</div>
        </div>
    </div>
    <div id="footer">
    </div>
</body>
</html>
